﻿<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
	xmlns:UltimatePoker="clr-namespace:UltimatePoker"
    xmlns:converters="clr-namespace:UltimatePoker.Converters"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
	x:Class="UltimatePoker.MainClientWindow"
	x:Name="Window"
	Title="Ultimate Poker"
    WindowStartupLocation="Manual"
    Top="10"
    Left="10"
	Width="1589" Height="1150"
    ResizeMode="CanMinimize">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/UltimatePoker;component/Resources/CardResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <converters:SpeedTextConverter x:Key="SpeedTextConverter"/>
            <UltimatePoker:NotConverter x:Key="NotConverter"/>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
        </ResourceDictionary>

    </Window.Resources>

    <DockPanel LastChildFill="True">

        <Menu DockPanel.Dock="Top">
            <MenuItem Header="Game">
                <MenuItem Header="Start New Game" Click="StartNewGame" IsEnabled="{Binding Path=GameBoard.IsRunning,Converter={StaticResource NotConverter}}"/>
                <MenuItem Header="Change Sign in name" Click="ChangeName" IsEnabled="{Binding Path=GameBoard.IsRunning,Converter={StaticResource NotConverter}}"/>
                <MenuItem x:Name="logout" Header="Logout" IsEnabled="{Binding Path=GameBoard.IsRunning}"/>
            </MenuItem>
            <MenuItem Header="Options">
                <CheckBox IsChecked="{Binding Path=AlwaysHighlight}">Always highlight hand</CheckBox>
                <StackPanel Orientation="Horizontal">
                    <Label>Game Speed</Label>
                    <Slider Value="{Binding Path=GameSpeed}" Minimum="0" Maximum="2" SmallChange="0.1" MinWidth="90"/>
                    <Label>
                        <Label.Content>
                            <Binding Path="GameSpeed" Converter="{StaticResource SpeedTextConverter}">
                                <Binding.ConverterParameter>
                                    <sys:Double>2</sys:Double>
                                </Binding.ConverterParameter>
                            </Binding>
                        </Label.Content>
                    </Label>
                </StackPanel>
            </MenuItem>
        </Menu>
        <Grid x:Name="LayoutRoot" Background="{x:Null}">
            <Grid.LayoutTransform>
                <ScaleTransform x:Name="layoutTransform"/>
            </Grid.LayoutTransform>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.2*"/>
                <ColumnDefinition Width="0.199*"/>
                <ColumnDefinition Width="0.198*"/>
                <ColumnDefinition Width="0.198*"/>
                <ColumnDefinition Width="0.207*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="0.05*"/>
                <RowDefinition Height="0.3*"/>
                <RowDefinition Height="0.289*"/>
                <RowDefinition Height="0.061*"/>
                <RowDefinition Height="0.35*"/>
            </Grid.RowDefinitions>
            <Rectangle Stroke="#FF000000" x:Name="BackGround" Grid.ColumnSpan="5" Grid.RowSpan="5">
                <Rectangle.Fill>
                    <LinearGradientBrush EndPoint="0.504,0.002" StartPoint="0.504,1.002">
                        <GradientStop Color="#FF0E3202" Offset="0"/>
                        <GradientStop Color="#FF37D505" Offset="1"/>
                    </LinearGradientBrush>
                </Rectangle.Fill>
            </Rectangle>
            <TextBlock Text="{Binding Path=BoardTitle,NotifyOnTargetUpdated=true}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" HorizontalAlignment="Center" VerticalAlignment="Center"
                       FontSize="32" Foreground="White" FontWeight="Bold" TargetUpdated="TextBlock_TargetUpdated" FontFamily="Gill Sans">
            	<TextBlock.BitmapEffect>
            		<BitmapEffectGroup>
            			<OuterGlowBitmapEffect GlowSize="3" Opacity="0.695"/>
            			<DropShadowBitmapEffect Direction="274"/>
            		</BitmapEffectGroup>
            	</TextBlock.BitmapEffect>
                  <TextBlock.TextEffects>
                    <TextEffect>
    				<TextEffect.Transform>
    						<ScaleTransform ScaleX="1.2" ScaleY="1.2"/>
    				</TextEffect.Transform>
    			</TextEffect>
    			<TextEffect>
    				<TextEffect.Transform>
    						<ScaleTransform ScaleX="1.35" ScaleY="1.35"/>
    				</TextEffect.Transform>
    			</TextEffect>
    			<TextEffect>
    				<TextEffect.Transform>
    						<ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
    				</TextEffect.Transform>
    			</TextEffect>
    			<TextEffect>
    				<TextEffect.Transform>
    						<ScaleTransform ScaleX="1.35" ScaleY="1.35"/>
    				</TextEffect.Transform>
    			</TextEffect>
    			<TextEffect>
    				<TextEffect.Transform>
    						<ScaleTransform ScaleX="1.2" ScaleY="1.2"/>
    				</TextEffect.Transform>
    			</TextEffect>
            </TextBlock.TextEffects>
                </TextBlock>
            <TextBlock FontSize="16" FontWeight="Bold" Foreground="#FFFFFFFF" Text="{Binding Path=Pot,Converter={StaticResource CashConverter}}" TextAlignment="Center" TextWrapping="Wrap" x:Name="PotText" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="3" Margin="256.73,0,253.206,0">
                <TextBlock.ToolTip>
                    <UltimatePoker:PotInformation x:Name="potInformation"/>
                </TextBlock.ToolTip>
                </TextBlock>
            <ItemsControl HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="CommonCardHolder" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="2"
									ItemsSource="{Binding Path=CommunityCards}" ItemTemplateSelector="{StaticResource CardTemplateSelector}">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel Orientation="Horizontal"/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemContainerStyle>
                    <Style TargetType="{x:Type ContentPresenter}">
                        <Setter Property="Margin" Value="3"/>
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ItemsControl>
            <UltimatePoker:PlayerControl x:Name="Player1" Grid.Row="2" DataContext="{Binding Path=OtherPlayers[0]}"/>
            <UltimatePoker:PlayerControl x:Name="Player2" Grid.Row="1" DataContext="{Binding Path=OtherPlayers[1]}"/>
            <UltimatePoker:PlayerControl x:Name="Player3" Grid.Row="1" Grid.Column="1" DataContext="{Binding Path=OtherPlayers[2]}"/>
            <UltimatePoker:PlayerControl x:Name="Player4" Grid.Row="1" Grid.Column="2" DataContext="{Binding Path=OtherPlayers[3]}"/>
            <UltimatePoker:PlayerControl x:Name="Player5" Grid.Row="1" Grid.Column="3" d:LayoutOverrides="Width" DataContext="{Binding Path=OtherPlayers[4]}"/>
            <UltimatePoker:PlayerControl x:Name="Player6" Grid.Row="1" Grid.Column="4" DataContext="{Binding Path=OtherPlayers[5]}"/>
            <UltimatePoker:PlayerControl x:Name="Player7" Grid.Row="2" Grid.Column="4" DataContext="{Binding Path=OtherPlayers[6]}"/>
            <UltimatePoker:MainPlayerControl x:Name="MainPlayer" Grid.Column="1" Grid.ColumnSpan="4" Grid.Row="4"
																			DataContext="{Binding Path=ThePlayer}"/>
            <Expander Grid.Row="4" Grid.Column="0" IsExpanded="{Binding Path=LogExpanded,Mode=TwoWay}" x:Name="logExapnsion"
                      ExpandDirection="Up" Header="Game Log" Foreground="White">
                <Border Background="#71000000" CornerRadius="20,20,0,0" BorderBrush="#FFC8BA01" BorderThickness="1">
                    <DockPanel LastChildFill="True">
                        <TextBox x:Name="chatBox" TextWrapping="Wrap" FontSize="16" Foreground="White" DockPanel.Dock="Bottom"
                                 Visibility="Collapsed"
                                 Height="30" Background="{x:Null}" BorderBrush="#FFC8BA01" BorderThickness="1,1,1,0"/>
                        <RichTextBox x:Name="logBox" BorderThickness="0"
            				Background="#00000000" IsReadOnly="True" 
            				Margin="5" FontSize="16" Foreground="White" FontWeight="Bold" VerticalScrollBarVisibility="Hidden">
                            <FlowDocument>
                                <Paragraph x:Name="logContent"/>
                            </FlowDocument>
                        </RichTextBox>
                    </DockPanel>
                </Border>
            </Expander>
        </Grid>
    </DockPanel>
</Window>